import { requestAjax } from './http'

export interface RoleVO {
  _id: string
  name: string
  code: string
  createTime: string
  level: number
}

export function getPubAdminRoleOptions(params?: any) {
  console.log(params);
  const res = {
    "code": 200,
    "status": 200,
    "data": [
      {
        "label": "超级管理员",
        "value": "root",
        "level": -1,
        "disabled": true,
        "visible": false
      },
      {
        "label": "系统管理员",
        "value": "admin",
        "level": 3,
        "disabled": true,
        "visible": false
      },
      {
        "label": "用户管理员",
        "value": "userAdmin",
        "level": 5,
        "disabled": true,
        "visible": false
      },
      {
        "label": "普通用户",
        "value": "default",
        "level": 100,
        "disabled": false,
        "visible": true
      }
    ],
    "msg": ""
  };
  return Promise.resolve(res);
  // return requestAjax({
  //   url: '/api/pub/admin/role/options',
  //   method: 'get',
  //   params
  // })
}

export function getPubAdminRoleListPage(params?: any) {
  console.log(params);
  const res = {
    "code": 200,
    "status": 200,
    "data": [
      {
        "_id": "67e98c5e852c2e089cadb006",
        "updateBy": "",
        "name": "超级管理员",
        "code": "root",
        "level": -1,
        "remark": "拥有系统的所有权",
        "permissionsCodes": [
          "home",
          "systemManage",
          "projectManage"
        ],
        "createTime": "2025-03-30T18:24:30.073Z",
        "updateTime": "2025-03-30T18:24:30.073Z",
        "createBy": ""
      },
      {
        "_id": "67e98c5e852c2e089cadb007",
        "updateBy": "",
        "name": "系统管理员",
        "code": "admin",
        "level": 3,
        "remark": "拥有最高系统配置权限",
        "permissionsCodes": [
          "home",
          "systemManage",
          "projectManage"
        ],
        "createTime": "2025-03-30T18:24:30.073Z",
        "updateTime": "2025-03-30T18:24:30.073Z",
        "createBy": ""
      },
      {
        "_id": "67e98c5e852c2e089cadb008",
        "updateBy": "",
        "name": "用户管理员",
        "code": "userAdmin",
        "level": 5,
        "remark": "拥有相关的配置权限",
        "permissionsCodes": [
          "home",
          "systemView",
          "projectManage"
        ],
        "createTime": "2025-03-30T18:24:30.073Z",
        "updateTime": "2025-03-30T18:24:30.073Z",
        "createBy": ""
      },
      {
        "_id": "67e98c5e852c2e089cadb009",
        "updateBy": "",
        "name": "普通用户",
        "code": "default",
        "level": 100,
        "remark": "拥有表单的查看权限",
        "permissionsCodes": [
          "home",
          "formRecordView"
        ],
        "createTime": "2025-03-30T18:24:30.073Z",
        "updateTime": "2025-03-30T18:24:30.073Z",
        "createBy": ""
      }
    ],
    "msg": "",
    "page": {
      "pageSize": 10,
      "currentPage": 1,
      "total": 4
    }
  };
  return Promise.resolve(res);
  // return requestAjax({
  //   url: `/api/pub/admin/role/list/page/${params.pageSize}/${params.currentPage}`,
  //   method: 'get',
  //   params
  // })
}

export function postPubAdminRoleSaveBatch(data?: any) {
  return requestAjax({
    url: '/api/pub/admin/role/save/batch',
    method: 'post',
    data
  })
}

export function deletePubAdminRoleDelete(data?: any) {
  return requestAjax({
    url: '/api/pub/admin/role/delete',
    method: 'delete',
    data
  })
}
